package member

import (
	"context"
	"group-buy/group_buy/internal/models"

	"group-buy/group_buy/internal/svc"
	"group-buy/group_buy/internal/types"

	"github.com/zeromicro/go-zero/core/logx"
)

type ChangeBusinessLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewChangeBusinessLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ChangeBusinessLogic {
	return &ChangeBusinessLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *ChangeBusinessLogic) ChangeBusiness(req *types.ChangeBusinessReq) (resp *types.ChangeBusinessRsp, err error) {
	member := &models.Member{Id: req.UserId, BusinessId: req.BusinessId}
	_, err = l.svcCtx.Engine.ID(member.Id).Update(member)

	return &types.ChangeBusinessRsp{},nil
}
